<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>作品分布</title>
    <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>全国投稿情况分布图</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="graph_flot.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="graph_flot.html#">选项1</a>
                            </li>
                            <li><a href="graph_flot.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div style="height:600px" id="echarts-map-chart"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.6"></script>



<!-- ECharts -->
<script src="js/plugins/echarts/echarts.min.js"></script>
<script src="js/plugins/echarts/china.js"></script>

<!-- 自定义js -->
<script src="js/content.js?v=1.0.0"></script>


<!-- ECharts demo data -->
<!--<script src="js/demo/echarts-demo.js"></script>-->
<script>
    var mapChart = echarts.init(document.getElementById("echarts-map-chart"));
    var data_tougao=[ {name: '北京',value: Math.round(Math.random()*1000)},
        {name: '天津',value: Math.round(Math.random()*1000)},
        {name: '上海',value: Math.round(Math.random()*1000)},
        {name: '重庆',value: Math.round(Math.random()*1000)},
        {name: '河北',value: Math.round(Math.random()*1000)},
        {name: '河南',value: Math.round(Math.random()*1000)},
        {name: '云南',value: Math.round(Math.random()*1000)},
        {name: '辽宁',value: Math.round(Math.random()*1000)},
        {name: '黑龙江',value: Math.round(Math.random()*1000)},
        {name: '湖南',value: Math.round(Math.random()*1000)},
        {name: '安徽',value: Math.round(Math.random()*1000)},
        {name: '山东',value: Math.round(Math.random()*1000)},
        {name: '新疆',value: Math.round(Math.random()*1000)},
        {name: '江苏',value: Math.round(Math.random()*1000)},
        {name: '浙江',value: Math.round(Math.random()*1000)},
        {name: '江西',value: Math.round(Math.random()*1000)},
        {name: '湖北',value: Math.round(Math.random()*1000)},
        {name: '广西',value: Math.round(Math.random()*1000)},
        {name: '甘肃',value: Math.round(Math.random()*1000)},
        {name: '山西',value: Math.round(Math.random()*1000)},
        {name: '内蒙古',value: Math.round(Math.random()*1000)},
        {name: '陕西',value: Math.round(Math.random()*1000)},
        {name: '吉林',value: Math.round(Math.random()*1000)},
        {name: '福建',value: Math.round(Math.random()*1000)},
        {name: '贵州',value: Math.round(Math.random()*1000)},
        {name: '广东',value: Math.round(Math.random()*1000)},
        {name: '青海',value: Math.round(Math.random()*1000)},
        {name: '西藏',value: Math.round(Math.random()*1000)},
        {name: '四川',value: Math.round(Math.random()*1000)},
        {name: '宁夏',value: Math.round(Math.random()*1000)},
        {name: '海南',value: Math.round(Math.random()*1000)},
        {name: '台湾',value: Math.round(Math.random()*1000)},
        {name: '香港',value: Math.round(Math.random()*1000)},
        {name: '澳门',value: Math.round(Math.random()*1000)}];
    var data_ruwei=[ {name: '北京',value: Math.round(Math.random()*1000)},
        {name: '天津',value: Math.round(Math.random()*1000)},
        {name: '上海',value: Math.round(Math.random()*1000)},
        {name: '重庆',value: Math.round(Math.random()*1000)},
        {name: '河北',value: Math.round(Math.random()*1000)},
        {name: '河南',value: Math.round(Math.random()*1000)},
        {name: '云南',value: Math.round(Math.random()*1000)},
        {name: '辽宁',value: Math.round(Math.random()*1000)},
        {name: '黑龙江',value: Math.round(Math.random()*1000)},
        {name: '湖南',value: Math.round(Math.random()*1000)},
        {name: '安徽',value: Math.round(Math.random()*1000)},
        {name: '山东',value: Math.round(Math.random()*1000)},
        {name: '新疆',value: Math.round(Math.random()*1000)},
        {name: '江苏',value: Math.round(Math.random()*1000)},
        {name: '浙江',value: Math.round(Math.random()*1000)},
        {name: '江西',value: Math.round(Math.random()*1000)},
        {name: '湖北',value: Math.round(Math.random()*1000)},
        {name: '广西',value: Math.round(Math.random()*1000)},
        {name: '甘肃',value: Math.round(Math.random()*1000)},
        {name: '山西',value: Math.round(Math.random()*1000)},
        {name: '内蒙古',value: Math.round(Math.random()*1000)},
        {name: '陕西',value: Math.round(Math.random()*1000)},
        {name: '吉林',value: Math.round(Math.random()*1000)},
        {name: '福建',value: Math.round(Math.random()*1000)},
        {name: '贵州',value: Math.round(Math.random()*1000)},
        {name: '广东',value: Math.round(Math.random()*1000)},
        {name: '青海',value: Math.round(Math.random()*1000)},
        {name: '西藏',value: Math.round(Math.random()*1000)},
        {name: '四川',value: Math.round(Math.random()*1000)},
        {name: '宁夏',value: Math.round(Math.random()*1000)},
        {name: '海南',value: Math.round(Math.random()*1000)},
        {name: '台湾',value: Math.round(Math.random()*1000)},
        {name: '香港',value: Math.round(Math.random()*1000)},
        {name: '澳门',value: Math.round(Math.random()*1000)}];
    var data_huojiang=[ {name: '北京',value: Math.round(Math.random()*1000)},
        {name: '天津',value: Math.round(Math.random()*100)},
        {name: '上海',value: Math.round(Math.random()*100)},
        {name: '重庆',value: Math.round(Math.random()*100)},
        {name: '河北',value: Math.round(Math.random()*100)},
        {name: '河南',value: Math.round(Math.random()*100)},
        {name: '云南',value: Math.round(Math.random()*100)},
        {name: '辽宁',value: Math.round(Math.random()*100)},
        {name: '黑龙江',value: Math.round(Math.random()*100)},
        {name: '湖南',value: Math.round(Math.random()*100)},
        {name: '安徽',value: Math.round(Math.random()*100)},
        {name: '山东',value: Math.round(Math.random()*100)},
        {name: '新疆',value: Math.round(Math.random()*100)},
        {name: '江苏',value: Math.round(Math.random()*100)},
        {name: '浙江',value: Math.round(Math.random()*100)},
        {name: '江西',value: Math.round(Math.random()*100)},
        {name: '湖北',value: Math.round(Math.random()*100)},
        {name: '广西',value: Math.round(Math.random()*100)},
        {name: '甘肃',value: Math.round(Math.random()*100)},
        {name: '山西',value: Math.round(Math.random()*100)},
        {name: '内蒙古',value: Math.round(Math.random()*100)},
        {name: '陕西',value: Math.round(Math.random()*100)},
        {name: '吉林',value: Math.round(Math.random()*100)},
        {name: '福建',value: Math.round(Math.random()*100)},
        {name: '贵州',value: Math.round(Math.random()*100)},
        {name: '广东',value: Math.round(Math.random()*100)},
        {name: '青海',value: Math.round(Math.random()*100)},
        {name: '西藏',value: Math.round(Math.random()*100)},
        {name: '四川',value: Math.round(Math.random()*100)},
        {name: '宁夏',value: Math.round(Math.random()*100)},
        {name: '海南',value: Math.round(Math.random()*100)},
        {name: '台湾',value: Math.round(Math.random()*100)},
        {name: '香港',value: Math.round(Math.random()*100)},
        {name: '澳门',value: Math.round(Math.random()*100)}];
    var mapoption = {
        title : {
            text: '全国投稿情况分布',
            subtext: '统计至当前日期',
            x:'center'
        },
        tooltip : {
            trigger: 'item',
            formatter:function(params){
                //定义一个res变量来保存最终返回的字符结果,并且先把地区名称放到里面
                var res=params.name+'<br />';
                //循环遍历series数据系列
                var myseries=mapoption.series;
                //循环遍历series数据系列
                for(var i=0;i<myseries.length;i++){
                    //在内部继续循环series[i],从data中判断：当地区名称等于params.name的时候就将当前数据和名称添加到res中供显示
                    for(var k=0;k<myseries[i].data.length;k++){
                        //console.log(myseries[i].data[k].name);
                        //如果data数据中的name和地区名称一样
                        if(myseries[i].data[k].name==params.name){
                            //将series数据系列每一项中的name和数据系列中当前地区的数据添加到res中
                            res+=myseries[i].name+':'+myseries[i].data[k].value+'<br />';
                        }
                    }
                }
                return res;
            }
        },
        legend: {
            orient: 'vertical',
            x:'left',
            data:['地区投稿量','作品入围数量','往届获奖情况']
        },
        dataRange: {
            min: 0,
            max: 2000,
            x: 'left',
            y: 'bottom',
            text:['高','低'],           // 文本，默认为数值文本
            calculable : true
        },
        toolbox: {
            show: true,
            orient : 'vertical',
            x: 'right',
            y: 'center',
            feature : {
                mark : {show: false},
                dataView : {show: true, readOnly: false},
                restore : {show: true},
                saveAsImage : {show: true}
            }
        },
        roamController: {
            show: true,
            x: 'right',
            mapTypeControl: {
                'china': true
            }
        },
        series : [
            {
                name: '地区投稿量',
                type: 'map',
                mapType: 'china',
                roam: false,
                itemStyle:{
                    normal:{label:{show:true}},
                    emphasis:{label:{show:true}}
                },
                data:data_tougao
            },
            {
                name: '作品入围数量',
                type: 'map',
                mapType: 'china',
                itemStyle:{
                    normal:{label:{show:true}},
                    emphasis:{label:{show:true}}
                },
                data:data_ruwei
            },
            {
                name: '往届获奖情况',
                type: 'map',
                mapType: 'china',
                itemStyle:{
                    normal:{label:{show:true}},
                    emphasis:{label:{show:true}}
                },
                data:data_huojiang
            }
        ]
    };
    var option_map = {
        title: {
            text: '全国投稿情况分布',
            subtext: '统计至当前日期',
            left: 'center'
        },
        tooltip: {
            trigger: 'item',
            formatter:function(params){
                //定义一个res变量来保存最终返回的字符结果,并且先把地区名称放到里面
                var res=params.name+'<br />';
                //循环遍历series数据系列
                var myseries=mapoption.series;
                //循环遍历series数据系列
                for(var i=0;i<myseries.length;i++){
                    //在内部继续循环series[i],从data中判断：当地区名称等于params.name的时候就将当前数据和名称添加到res中供显示
                    res+='<span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:' + mapChart.getOption().color[i] + '"></span>'+myseries[i].name+':'+myseries[i].data[params.dataIndex].value+'<br />';
                }
                return res;
            }
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data:['地区投稿量','作品入围数量','往届获奖情况']
        },
        visualMap: {
            min: 0,
            max: 2000,
            left: 'left',
            top: 'bottom',
            text: ['高','低'],           // 文本，默认为数值文本
            calculable: true
        },
        color: ["#c23531","#2f4554","#61a0a8"],
        toolbox: {
            show: true,
            orient: 'vertical',
            left: 'right',
            top: 'center',
            feature: {
                dataView: {readOnly: false},
                restore: {},
                saveAsImage: {}
            }
        },
        series: [
            {
                name: '地区投稿量',
                type: 'map',
                mapType: 'china',
                roam: false,
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                data:data_tougao
            },
            {
                name: '作品入围数量',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                data:data_ruwei
            },
            {
                name: '往届获奖情况',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                data:data_huojiang
            }
        ]
    };
    mapChart.setOption(option_map);

    $(window).resize(mapChart.resize);
</script>

</body>

</html>
